using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace ClickSocial.Admin.controles
{
    public partial class BaseUser : System.Web.UI.UserControl
    {
       
        virtual protected void ddlRoles_Init(object sender, EventArgs e)
        {
            DropDownList ddl = (DropDownList)sender;

            if (Context.User.IsInRole("Host"))
            {
                ddl.Items.Add(new ListItem("Host", "Host"));
                ddl.Items.Add(new ListItem("Fotografo", "Fotografo"));
                ddl.Items.Add(new ListItem("UserEvento", "UserEvent"));
                ddl.Items.Add(new ListItem("User", "User"));

            }
            else if (Context.User.IsInRole("Fotografo"))
            {
                ddl.Items.Add(new ListItem("UserEvento", "UserEvent"));
            }
        }

        virtual protected void ddlRoles_SelectedIndexChanged(object sender, EventArgs e)
        {
            HostCambiaVisibilidad();
        }

        virtual protected void btnGuardar_Click(object sender, EventArgs e)
        {

        }

        virtual protected void HostCambiaVisibilidad()
        {
            if (Context.User.IsInRole("Host"))
            {
                lblEspacio.Visible = ddlRoles.SelectedValue.Equals("Fotografo");
                chkPrecio.Visible = ddlRoles.SelectedValue.Equals("Fotografo");
                txtEspacio.Visible = ddlRoles.SelectedValue.Equals("Fotografo");
                lblUnidad.Visible = ddlRoles.SelectedValue.Equals("Fotografo");
                rfvEspacio.Visible = ddlRoles.SelectedValue.Equals("Fotografo");
                RangeValidatorEspacio.Visible = ddlRoles.SelectedValue.Equals("Fotografo");
            }
        }
    }
}